package com.ewili.x.special.dao.inter;

import com.ewili.x.special.entity.TradableHolder;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.Date;

public interface TradableHolderDao extends JpaRepository<TradableHolder, Long> {

    TradableHolder findByStockCodeAndSeasonAndShareholderName(String stockCode, Date season, String shareHolderName);

    @Query(value = "SELECT MAX(season) FROM TradableHolder WHERE stockCode = ?1")
    Date selectMaxDateFinanceReportDate(String stockCode);

    Boolean existsByStockCodeAndSeason(String stockCode, Date season);

    Boolean existsByStockCodeAndSeasonAndShareholderName(String stockCode, Date season, String shareHolderName);
}
